package com.dongdongshop.service.impl;

import com.dongdongshop.annotation.Log;
import com.dongdongshop.mapper.TbBrandMapper;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.pojo.TbBrandExample;
import com.dongdongshop.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    private TbBrandMapper tbBrandMapper;

    @Override
    @Log
    public List<TbBrand> listBrands() {
        return tbBrandMapper.selectByExample(new TbBrandExample());
    }

    @Override
    @Log
    public void insertBrandInfo(TbBrand tbBrand) {
        tbBrandMapper.insertSelective(tbBrand);
    }

    @Override
    @Log
    public TbBrand updateBrand(Long id) {
        return tbBrandMapper.selectByPrimaryKey(id);
    }

    @Override
    @Log
    public void updateBrandInfo(TbBrand tbBrand) {
        tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
    }

    @Override
    @Log
    public void deleteBrandInfo(Long[] id) {
        tbBrandMapper.deleteByid(id);
    }
}
